<div class="clr-row">
  <div
    *ngIf="resourceGroup"
    class="clr-col-xs-12	clr-col-sm-6	clr-col-md-6	clr-col-lg-6	clr-col-xl-6"
  >
    <h5>聚合组 {{ resourceGroup.name }}</h5>

    <div *ngIf="buyAction && resourceGroup.id !== '0'">
      <span>比率 (平均): </span>

      <input
        type="range"
        [name]="'gl' + resourceGroup.id"
        min="0"
        max="100"
        step="1"
        [(ngModel)]="operativity"
        (ngModelChange)="changeOperativity()"
      />
    </div>

    <app-action
      *ngFor="let act of actions; trackBy: getActId"
      [action]="act"
    ></app-action>
  </div>
  <div class="clr-col-xs-12	clr-col-sm-6	clr-col-md-6	clr-col-lg-6	clr-col-xl-6">
    <h6>统计:</h6>
    <clr-datagrid
      *ngIf="resourceGroup"
      class="datagrid-compact"
      [(clrDgSelected)]="resourceGroup.selected"
      (clrDgSelectedChange)="selectedChanged($event)"
    >
      <clr-dg-column [clrDgField]="'unit.name'">名称</clr-dg-column>
      <clr-dg-column [clrDgSortBy]="resourceQuantitySorter">
        <span>数量</span>
      </clr-dg-column>
      <clr-dg-column [clrDgSortBy]="limitResourceSorter" *ngIf="storage">
        <span>存储</span>
      </clr-dg-column>
      <clr-dg-column [clrDgSortBy]="expansionResourceSorter" *ngIf="storage">
        <span>存储经验</span>
      </clr-dg-column>

      <clr-dg-row
        *clrDgItems="let unit of resourceGroup.unlockedResources"
        [clrDgItem]="unit"
      >
        <clr-dg-cell>
          <a [routerLink]="'/nav/unit/' + unit.id">
            {{ unit.name }}
          </a>
        </clr-dg-cell>
        <clr-dg-cell>
          <app-formatted-quantity
            [quantity]="unit.quantity"
          ></app-formatted-quantity>

          <ng-container *ngIf="unit.isLimited">
            /
            <app-formatted-quantity
              [quantity]="unit.limit"
            ></app-formatted-quantity>
          </ng-container>
        </clr-dg-cell>
        <clr-dg-cell *ngIf="storage">
          <app-formatted-quantity
            [quantity]="unit.limit"
          ></app-formatted-quantity>
        </clr-dg-cell>
        <clr-dg-cell *ngIf="storage">
          <app-formatted-quantity
            [quantity]="unit.limitStorage?.quantity"
          ></app-formatted-quantity>
        </clr-dg-cell>
      </clr-dg-row>
    </clr-datagrid>
  </div>
</div>
